package com.example.gym_manage_system.view.components.panel;

import javax.swing.*;
import java.awt.*;

/**
 * @author qzy
 * @description 描述
 * @create 2023-12-09 21:40
 */
public class BackgroundImagePanel extends JPanel {
    private final Image backgroundImage;

    public BackgroundImagePanel(String imagePath) {
        String baseImgUrl = "E:\\学习\\南宁师范大学\\Java程序设计课程\\项目\\gym_manage_system\\src\\main\\java\\com\\example\\gym_manage_system\\images\\";
        imagePath = baseImgUrl + imagePath;
        backgroundImage = new ImageIcon(imagePath).getImage();
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.drawImage(backgroundImage, 0, 0, getWidth(), getHeight(), this);
    }
}
